//
//  NSString+extension.m
//  新浪微博
//
//  Created by apple on 15/8/31.
//  Copyright (c) 2015年 samuel. All rights reserved.
//

#import "NSString+extension.h"

@implementation NSString (extension)

-(CGSize)sizeWithFont:(UIFont *)font
{
    NSMutableDictionary *attrs = [NSMutableDictionary dictionary];
    attrs[NSFontAttributeName] = font;
    return [self sizeWithAttributes:attrs];
}

-(CGSize)sizeWithFont:(UIFont *)font maxCGSize:(CGSize)maxSize
{
    NSMutableDictionary *attrs = [NSMutableDictionary dictionary];
    attrs[NSFontAttributeName] = font;
    return [self boundingRectWithSize:maxSize options:NSStringDrawingUsesLineFragmentOrigin attributes:attrs context:nil].size;
}

@end
